import vue from "@vitejs/plugin-vue"
import path from "path"
// import { visualizer } from "rollup-plugin-visualizer"
import { defineConfig } from "vite"

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
    plugins: [vue()], // 注册插件
    server: {
        port: 8000,
        proxy:{
            //这里是通过请求/api 来转发到 https://api.pingping6.com/
            //假如你要请求https://api.*.com/a/a
            //那么axios的url，可以配置为 /api/a/a
            '/gtserver': 'http://39.108.58.158:8090'
        }
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, './src'),
        },
    },
    // 拆分打包，不配置则会把所有的静态资源放在assets下
    build:{
        assetsDir: 'static/img/',
        rollupOptions: {
           output: {
               chunkFileNames: 'static/js/[name]-[hash].js',
               entryFileNames: 'static/js/[name]-[hash].js',
               assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
           },
       },
   }
}));
